package com.qf.purchase.service;

import com.github.pagehelper.PageInfo;
import com.qf.purchase.dao.GoodsDao;
import com.qf.purchase.po.Goods;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Service
public class GoodsServiceImpl implements GoodsService{
    @Resource
    private GoodsDao goodsDao;

    @Override
    public boolean addGoods(Goods goods) {
        boolean f = goodsDao.addGoods(goods)>0?true:false;
        return f;
    }

    @Override
    public PageInfo<Goods> getAllGoodsByPage(Map params) {
        List<Goods> goodsList=goodsDao.getAllGoodsByPage(params);
        PageInfo<Goods> pageInfo = new PageInfo<Goods>(goodsList);
        return pageInfo;
    }

    @Override
    public boolean updateGoods(Goods goods) {
        return goodsDao.updateGoods(goods)>0;
    }

    @Override
    public Goods findGoodsById(int id) {
        return goodsDao.findGoodsById(id);
    }
}
